<template>
  <div>
    <Info v-if="isLogin" @changeLogin="changeLogin"></Info>
    <van-tabs v-model="active" v-else>
      <van-tab title="登录">
        <login></login>
      </van-tab>
      <van-tab title="注册">
        <reigster @changeActive="changeActive"></reigster>
      </van-tab>
    </van-tabs>
  </div>
</template>
<script>
import LoginViewVue from "@/components/mine/LoginView.vue";
import RegisterViewVue from "@/components/mine/RegisterView.vue";
import Info from  "@/components/mine/InfoView.vue";
export default {
    data(){
        return {
            active: 0,
            isLogin:false,
        }
    },
    created(){
        let  info  =window.localStorage.getItem("userinfo");
        if(info){
            this.isLogin = true;
        }else{
            this.isLogin = false;
        }
    },
    methods:{
        changeLogin(flag){
            this.isLogin = flag;
        },
        changeActive(index){
            this.active = index;
        }

    },
  components: {
    login: LoginViewVue,
    reigster: RegisterViewVue,
    Info
  },
};
</script>
